package com.macrounion.atv.controller.api;


import com.macrounion.atv.service.dto.resp.SpotListRespDto;
import com.macrounion.atv.service.dto.resp.SpotRespDto;
import com.macrounion.atv.service.entity.ext.SpotExt;
import com.macrounion.base.service.dto.BaseRespDto;
import com.macrounion.base.service.dto.PageRespDto;
import org.springframework.web.bind.annotation.*;

import com.macrounion.atv.processor.SpotProcessor;
import com.macrounion.atv.service.entity.Spot;
import com.macrounion.atv.service.entity.User;
import com.macrounion.atv.service.service.SpotService;
import com.macrounion.base.controller.api.BaseApiController;

import java.util.List;

@RestController
@RequestMapping("/api/spot")
public class SpotApiController extends BaseApiController<Spot, Spot, SpotProcessor, SpotService, Spot, User> {

    @GetMapping("/getSpotByParentId")
    public List<Spot> getSpotList(String parentId){
        return processor.getSpotByParentId(parentId);
    }

    @GetMapping("/getSpotTree")
    public List<SpotRespDto> getTreeSpot(String parentSpotId,Integer isLoadDevice,Integer isLoadPing){
        return processor.getTreeSpot(parentSpotId,isLoadDevice,isLoadPing);
    }

    @GetMapping("/getAllSpot")
    public List<Spot> getAllSpot(String curSpotId){
        return  processor.getAllSpot(curSpotId);
    }

    @PostMapping("/requestPageList")
    public PageRespDto<SpotListRespDto> getSpotList(@RequestBody SpotExt spot){
        return processor.getSpotList(spot);
    }

    @GetMapping("/getChildrenById")
    public List<Spot> getChildrenById(String parentId){
        return processor.getChildrenById(parentId);
    }

}